package com.shop.shoporder.mapper;

import com.shop.shoporder.entity.GroupbuyGood;
import com.shop.shoporder.entity.GroupbuyGoodInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface GroupbuyGoodMapper {
    int deleteByPrimaryKey(int groupbuygoodId);

    int insert(GroupbuyGood record);

    int insertSelective(GroupbuyGood record);

    GroupbuyGood selectByPrimaryKey(int groupbuygoodId);

    int updateByPrimaryKeySelective(GroupbuyGood record);

    int updateByPrimaryKey(GroupbuyGood record);

    //获取团购商品列表
    List<GroupbuyGoodInfo> getGroupbuyGooods();

    //获取团购商品
    GroupbuyGood getGroupbuyGood(int groupbuygoodId);

    //根据一级分类ID查询团购产品
    List<GroupbuyGoodInfo> getGroupbuyGoodByClassfyId(int classfyId);

    //根据产品ID和规格ID查询团购产品
    GroupbuyGood getGroupbuyGoodByGoodIdAndSpecId(@Param("goodId") int goodId,@Param("specId") int specId);

    /**
     * 查询团购产品
     * @param goodId
     * @param specId
     * @return
     */
   GroupbuyGoodInfo getGoodInfoByGoodIdAndSpecId(@Param("goodId") int goodId,@Param("specId") int specId);


    /**
     * 根据商品ID查询所有的团购产品的规格
     * @param goodId
     * @return
     */
    List<GroupbuyGood> getGroupbuyGoodListByGoodId(@Param("goodId") int goodId);
}